package com.yanqu.road.server.cmd.activity;

import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.activity.StrongholdActivityProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_GENERAL_MEMBER_CONDITION_DATA_RESP, desc = "查询跨服活动成员贡献信息响应")
public class CrossGeneralActivityMemberConditionDataRespCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        StrongholdActivityProto.CrossStrongholdConditionUnionMemberDataRespMsg2 reqMsg = StrongholdActivityProto.CrossStrongholdConditionUnionMemberDataRespMsg2.parseFrom(packet.getBytes());

        StrongholdActivityProto.StrongholdActivityConditionUnionMemberDataRespMsg.Builder msg = StrongholdActivityProto.StrongholdActivityConditionUnionMemberDataRespMsg.newBuilder();
        msg.setDataList(reqMsg.getDataList());
        msg.setRet(reqMsg.getRet());
        if(0 == reqMsg.getRet()){
            msg.setDataList(reqMsg.getDataList());
        }
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.U_GENERAL_ACTIVITY_MEMBER_CONDITION_DATA, msg);
        MessageHelper.sendPacket(reqMsg.getServerId(), reqMsg.getUserId(), pbMsg);

        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
